package org.codefinger.dao.impl.sql;

import org.codefinger.dao.impl.SQLVisitor;

public class Where {

	private Expression	exp;

	public Where(Expression exp) {
		super();
		this.exp = exp;
	}

	public void visit(SQLVisitor visitor) {
		visitor.appendSQL(" WHERE ");
		if (!exp.matchVisit(visitor)) {
			visitor.back(visitor.getSqlSize() - 7);
		}
	}

	public boolean matchVisit(SQLVisitor visitor) {
		visitor.appendSQL(" WHERE ");
		if (!exp.matchVisit(visitor)) {
			visitor.back(visitor.getSqlSize() - 7);
			return false;
		}
		return true;
	}

}
